package cn.interestingshop.test;

import cn.interestingshop.utils.JedisUtil;
import redis.clients.jedis.Jedis;

public class JedisDemo01 {

    public void testJedis(){
//        Jedis jedis=new Jedis("127.0.0.1",6379);
        Jedis jedis= JedisUtil.getJedis();
        //jedis.auth("123456"); 密码
        jedis.set("uname","zhangsan");//将key为uname值为zhangsan存入redis数据库中
        String value=jedis.get("uname");
        System.out.println("uname的值为:"+value);
        jedis.del("uname");
        jedis.expire("uname",6);
        long seconds=jedis.ttl("uname");
        boolean isfalg=jedis.exists("uname");
    }

    public static void main(String[] args) {
        JedisDemo01 jedisDemo01=new JedisDemo01();

        jedisDemo01.testJedis();
    }
}
